package pbAutoMain;

import java.io.File;
import java.io.InputStream;

public class PbToJava {

	public static void main(String args[]) {
		Runtime runtime = Runtime.getRuntime();
		String pbPath = "./pb";
		String outPath = "./src/com/vlink/hdj/proto/user";
		String fileName = "ProtocSpaceVideo.proto";

		try {
			Process pro = runtime.exec("protoc -I=" + pbPath + " --java_out=" + outPath + "  " + fileName);
			System.out.println("protoc -I=" + pbPath + " --java_out=" + outPath + "  " + fileName);
			InputStream stream = pro.getErrorStream();
			byte[] b = new byte[1024];
			int len = 1024;
			while (stream.read(b, 0, len) != -1) {
				String str = new String(b);
				System.out.println(str);
			}

			System.out.println();
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}
